package com.medical.data.domain;

import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.annotation.*;
import com.medical.data.utils.HtmlUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 
 * </p>
 *
 * @author cj
 * @since 2024-02-06
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="FormItem对象", description="")
@Accessors(chain = true)
public class FormItem implements Serializable {

/*    public FormItem(){}

    public FormItem(String id, String formTemplateId, String formItemId, String label, String itemType, Boolean required, String placeholder, String scheme, Map<String, Object> schemeJson, String regList, List<JSONObject> regListJson, Boolean isDisplayType, Boolean isHideType, Boolean isSpecialType, Boolean showLabel, String defaultValue, Long sort, Integer span, Boolean isDelete, Integer version, Date createTime, Date updateTime) {
        this.id = id;
        this.formTemplateId = formTemplateId;
        this.formItemId = formItemId;
        this.label = HtmlUtils.cleanHtmlTag(label);
        this.itemType = itemType;
        this.required = required;
        this.placeholder = placeholder;
        this.scheme = scheme;
        this.schemeJson = JSONObject.parseObject(scheme);
        this.regList = regList;
        this.regListJson = this.regListJson = JSONArray.parseArray(regList,
                JSONObject.class);
        this.isDisplayType = isDisplayType;
        this.isHideType = isHideType;
        this.isSpecialType = isSpecialType;
        this.showLabel = showLabel;
        this.defaultValue = defaultValue;
        this.sort = sort;
        this.span = span;
        this.isDelete = isDelete;
        this.version = version;
        this.createTime = createTime;
        this.updateTime = updateTime;
    }*/

    private static final long serialVersionUID = 1L;

      @TableId(value = "id", type = IdType.ASSIGN_UUID)
    private String id;

    private String formTemplateId;

    private String formId;

    @ApiModelProperty(value = "组件key")
    private String formItemId;

    private String label;

    @ApiModelProperty(value = "输入型，选择型等")
    private String itemType;

    @ApiModelProperty(value = "0为非必填")
    private Boolean required;

    @ApiModelProperty(value = "提示型数据")
    private String placeholder;

    @ApiModelProperty(value = "表单样式")
    private String scheme;

/*    @ApiModelProperty(value = "表单样式的json")
    private Map<String,Object> schemeJson;*/

    @ApiModelProperty(value = "填入信息的校验")
    private String regList;

/*    @ApiModelProperty(value = "填入信息的校验Json格式")
    private List<JSONObject> regListJson;*/

    @ApiModelProperty(value = "展示类型组件")
    private Boolean isDisplayType;

    @ApiModelProperty(value = "隐藏类型组件")
    private Boolean isHideType;

    @ApiModelProperty(value = "特殊处理类型")
    private Boolean isSpecialType;

    @ApiModelProperty(value = "是否显示标签")
    private Boolean showLabel;

    @ApiModelProperty(value = "表单项默认值")
    private String defaultValue;

    @ApiModelProperty(value = "排序")
    private Long sort;

    @ApiModelProperty(value = "栅格宽度")
    private Integer span;

    @ApiModelProperty(value = "表单配置")
    private String config;

    @ApiModelProperty(value = "组件类型")
    private String compType;

    @ApiModelProperty(value = "组件类型")
    private String oneItemId;

    @TableLogic
    @ApiModelProperty(value = "软删除：0代表未删除1代表删除")
    private Boolean isDelete;

    @Version
    @ApiModelProperty(value = "版本号")
    private Integer version;

    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(value = "更新时间")
    private Date updateTime;
/*

    public void setId(String id) {
        this.id = id;
    }wwww

    public void setFormTemplateId(String formTemplateId) {
        this.formTemplateId = formTemplateId;
    }

    public void setFormItemId(String formItemId) {
        this.formItemId = formItemId;
    }

    public void setLabel(String label) {
        this.label = HtmlUtils.cleanHtmlTag(label);
    }

    public void setItemType(String itemType) {
        this.itemType = itemType;
    }

    public void setRequired(Boolean required) {
        this.required = required;
    }

    public void setPlaceholder(String placeholder) {
        this.placeholder = placeholder;
    }

    public void setScheme(String scheme) {
        this.scheme = scheme;
        */
/*this.schemeJson = JSONObject.parseObject(scheme);*//*

    }

    public void setRegList(String regList) {
        this.regList = regList;
        this.regListJson = JSONArray.parseArray(regList,
                JSONObject.class);
    }

    public void setIsDisplayType(Boolean displayType) {
        isDisplayType = displayType;
    }

    public void setIsHideType(Boolean hideType) {
        isHideType = hideType;
    }

    public void setIsSpecialType(Boolean specialType) {
        isSpecialType = specialType;
    }

    public void setShowLabel(Boolean showLabel) {
        this.showLabel = showLabel;
    }

    public void setDefaultValue(String defaultValue) {
        this.defaultValue = defaultValue;
    }

    public void setSort(Long sort) {
        this.sort = sort;
    }

    public void setSpan(Integer span) {
        this.span = span;
    }

    public void setDelete(Boolean delete) {
        isDelete = delete;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
*/

}
